<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.tooltip');
JHTML::stylesheet('base.css', JURI::root().'/components/com_simplelisting/css/');
$option = JRequest::getVar('option');

?>

<div id="cpanel" style="float:left;width:83%;">
    <form action="index.php" method="post" name="adminForm">
        <table class="adminlist">
            <tr>
                <th width="2%" align="center">
                    <?php echo JTEXT::_('HEADER_HASH'); ?>
                </th>
                <th width="85%" align="left">
                    <?php
                    $t_dir = $this->dir;
                    echo $t_dir; ?>
                </th>
                <th width="10%" align="center">
                    <?php echo JText::_( 'TRANS_WRITABLE' ); ?>/<?php echo JText::_( 'TRANS_UNWRITABLE' ); ?>
                </th>
            </tr>
            <?php

            $k = 0;
            $t_files = $this->files;
            for ($i = 0, $n = count($t_files); $i < $n; $i++) {
                    $file = & $t_files[$i];
            ?>
            <tr class="<?php echo 'row'. $k; ?>">
                <td width="2%">
                    <input type="radio" id="cb<?php echo $i;?>" name="filename" value="<?php echo htmlspecialchars( $file, ENT_COMPAT, 'UTF-8' ); ?>" onClick="isChecked(this.checked);" />
                </td>
                <td width="85%">
                    <?php
                        $this_file_component=$this->lang.'.'.$option.'.ini';
                            if($file==$this_file_component){
                                echo '<font color="green" size="+1">'.$file.'</font>';
                            } else {
                                echo $file;
                    }
                    ?>
                </td>
                <td width="10%" align="center">
                    <?php echo is_writable($t_dir.DS.$file) ? '<font color="green"> '. JText::_( 'TRANS_WRITABLE' ) .'</font>' : '<font color="red"> '. JText::_( 'TRANS_UNWRITABLE' ) .'</font>' ?>
                </td>
            </tr>
            <?php
                $k = 1 - $k;
            }
            ?>
        </table>
        <input type="hidden" name="id" value="<?php echo $this->lang; ?>" />
        <input type="hidden" name="cid[]" value="<?php echo $this->lang; ?>" />
        <input type="hidden" name="option" value="<?php echo $option;?>" />
        <input type="hidden" name="task" value="" />
        <input type="hidden" name="boxchecked" value="0" />
        <input type="hidden" name="client" value="<?php echo $this->client->id;?>" />
        <input type="hidden" name="controller" value="languages" />
    </form>
</div>

<div id="tabs" style="float:right; width:16%;">

 	<?php
	jimport('joomla.html.pane');

	$pane =& JPane::getInstance('Tabs');

	echo $pane->startPane('simplelistingPane');
            echo $pane->startPanel(JText::_('TAB_TRANS'), 'transtab');
	?>
            <table class="trans_tabs">
                <tbody>
                    <tr>
                        <td class="trans_tabs"><?php echo JText::_( 'TRANS_CURRENT' );?> : <font color="green"><?php echo JRequest::getVar('client') ? ' '. JText::_( 'TRANS_ADMIN' ) .'' : ''. JText::_( 'TRANS_SITE' ) .'' ?> - <?php echo $this->lang; ?></font></td>
                    </tr>
                </tbody>
            </table>



            <table class="trans_tabs" cellspacing="5">
                <tbody>

                <?php
                if (JRequest::getVar('client',0) == 1) {
                ?>

                <td  class="trans_tabs"><a style="font-weight:bold;" href="<?php echo JRoute::_('index.php?option='.$option.'&view=languages&client=0');?>"><?php echo JText::_( 'TRANS_SITE_TITLE' );?></a></td>

                <td  class="trans_tabs"><a style="font-weight:bold; color: green;" href="<?php echo JRoute::_('index.php?option='.$option.'&view=languages&client=1');?>"><?php echo JText::_( 'TRANS_ADMIN_TITLE' );?></a>

                <?php
                foreach ($this->dirs as $dirs)
                {
                    echo '<br><a href="'.JRoute::_('index.php?option='.$option.'&view=languages&client=1&id='.$dirs).'">'.$dirs.'</a>';
                }
                echo '</td>';
                } else {
                ?>

                <td  class="trans_tabs"><a style="font-weight:bold; color: green;" href="<?php echo JRoute::_('index.php?option='.$option.'&view=languages&client=0');?>"><?php echo JText::_( 'TRANS_SITE_TITLE' );?></a>

                <?php
                foreach ($this->dirs as $dirs)
                        {
                        if(strlen($dirs)==5){
                        echo '<br><a href="'.JRoute::_('index.php?option='.$option.'&view=languages&client=0&id='.$dirs).'">'.$dirs.'</a>';
                        }
                        }
                echo '</td>';
                ?>
                <td  class="trans_tabs"><a style="font-weight:bold;" href="<?php echo JRoute::_('index.php?option='.$option.'&view=languages&client=1');?>"><?php echo JText::_( 'TRANS_ADMIN_TITLE' );?></a></td>


                <?php }?>

                </tbody>
            </table>
    <?php
        echo $pane->endPanel();
    echo $pane->endPane();
    ?>
</div>
<div class="clr"></div>